@extends('layouts.master')

@section('title')
    项目管理——央票通后台管理
@stop

@section('app_css')
    <link rel="stylesheet" href="/resource/css/bootstrap.min.css">
    <link rel="stylesheet" href="/resource/css/font-awesome.min.css">
    <link rel="stylesheet" href="/resource/css/animate.min.css">
    <link rel="stylesheet" href="/resource/css/custom.css">
    <link rel="stylesheet" href="/resource/css/green.css">
    <link rel="stylesheet" href="/resource/css/fileinput.min.css">
    <link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
@stop

@section('app_js')
    <!--[if lt IE 9]>
    <script type="text/javascript" src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script type="text/javascript" src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script type="text/javascript" src="/resource/js/jquery.min.js"></script>
    <script type="text/javascript" src="/resource/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/resource/js/custom.js"></script>
    <!-- icheck -->
    <script type="text/javascript" src="/resource/js/icheck.min.js"></script>
    <!-- Datatables -->
    <script type="text/javascript" src="/resource/js/jquery.dataTables.js"></script>
    <script type="text/javascript" src="/resource/js/J_main.js"></script>
    <!-- 添加图片 -->
    <script src="/resource/js/fileinput.min.js"></script>
    <script src="/resource/js/fileinput_locale_zh.js"></script>
    <!-- 编辑器 -->
    <script src="/resource/js/umeditor.config.js" charset="utf-8"></script>
    <script src="/resource/js/umeditor.min.js" charset="utf-8"></script>
    <script src="/resource/js/lang/zh-cn/zh-cn.js"></script>
    <script>
        var um = UM.getEditor('editor1');
        var um = UM.getEditor('editor2');
    </script>
    <link rel="stylesheet" href="/resource/js/themes/default/css/umeditor.css">
    <script type="text/javascript" src="/resource/js/T.js"></script>
    {{--<script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>--}}
    <script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $(document).delegate('#quality','change',function(){
            var quality = $('#quality').val();
            if(quality > 0){
                var data = {quality:quality};
                T.restGet('/level_info',data,function(response){
                    if(response.data.length > 0){
                        $.each(response.data, function(i,n){
                            $('#level').append("<option value='"+ n.level_id +"'>"+n.level_name+"</option>");
                        });
                    }
                });
                T.restGet('/spec_info',data,function(response){
                    $.each(response.data, function(i,n){
                        $('#spec').append("<option value='"+ n.spec_id +"'>"+n.spec_name+"</option>");
                    });
                });
            }
        });
        $( ".time" ).datepicker({ dateFormat:'yy-mm-dd'});
    </script>
@stop

@section('content')
    <body class="nav-md">

    <div class="container body">


        <div class="main_container">

            @include('common.admin_menu')

            <!-- top navigation -->
            @include('common.admin_nav')
            <!-- /top navigation -->


            <!-- page content -->
            <div class="right_col" role="main">

                <div class="">

                    <div class="row cont">

                        <div class="col-md-6 col-sm-12 col-xs-12">
                            <div class="x_panel">
                                <div class="x_title">
                                    <h2>项目管理</h2>
                                    <div class="clearfix"></div>
                                </div>

                                <div class="x_content">
                                    <br />
                                    @if(empty($project))
                                        {{ Form::open(['url'=>'/add_manage_project', 'id'=>'demo-form2', 'class'=> 'form-horizontal form-label-left', 'files' => true, 'method' => 'post']) }}
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="first-name">项目名称
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="project_name" type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="first-name">开始时间
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="start_time" type="text"  required="required" class="form-control col-md-7 col-xs-12 time">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="first-name">到期时间
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="end_time" type="text"  required="required" class="form-control col-md-7 col-xs-12 time">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="last-name">出票公司
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                            <select class="form-control"  name="company_name">
                                                <option value="0">请选择…</option>
                                                @foreach($company_name as $k => $v)
                                                    <option value="{{$v->company_name}}">{{$v->company_name}}</option>
                                                @endforeach
                                            </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="last-name">保理公司
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                            <select class="form-control"  name="factoring_company">
                                                <option value="0">请选择…</option>
                                                @foreach($factoring_company as $k => $v)
                                                    <option value="{{$v->f_company_name}}">{{$v->f_company_name}}</option>
                                                @endforeach
                                            </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="last-name">合作机构
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select class="form-control"  name="partner">
                                                    <option value="0">请选择…</option>
                                                    @foreach($partner as $k => $v)
                                                        <option value="{{$v->partner_id}}">{{$v->partner_name}}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目规模</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="project_scale" class="form-control col-md-7 col-xs-12" type="text">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">年收益率</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="yield_rate" class="form-control col-md-7 col-xs-12" type="text">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目期限</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="limit" class="form-control col-md-7 col-xs-12" type="text">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">还款方式</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select class="form-control"  name="pay_id">
                                                    <option value="0">请选择…</option>
                                                    @foreach($pay_type as $k => $p)
                                                        <option value="{{ $k }}">{{ $p }}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">票据种类</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select id="ticket_type" class="form-control" name="ticket_type">
                                                    <option value="0">请选择…</option>
                                                    @foreach($ticket_type as $k => $t)
                                                        <option value="{{ $k }}">{{$t}}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目类别</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select id="type" class="form-control" name="type">
                                                        <option value="0">请选择…</option>
                                                        <option value="1">央票通</option>
                                                        <option value="2">上市通</option>

                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">借款用途</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <script id="editor1" type="text/plain" style="width:100%" name="purpose" ></script>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目介绍</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <script id="editor2" type="text/plain" style="width:100%" name="content" ></script>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">商票样式</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="image1" type="file" class="file form-control col-md-7 col-xs-12">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">商票样式</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="image2" type="file" class="file form-control col-md-7 col-xs-12">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">资料图片</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="img1" type="file" class="file form-control col-md-7 col-xs-12">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">资料图片</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="img2" type="file" class="file form-control col-md-7 col-xs-12">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">资料图片</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="img3" type="file" class="file form-control col-md-7 col-xs-12">
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目状态</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" value="0" checked> 审核中
                                                </label>
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" value="1"> 未通过
                                                </label>
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" value="2"> 已通过
                                                </label>
                                            </div>
                                        </div>
                                        {{--<div class="form-group">--}}
                                            {{--<label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目图片</label>--}}
                                            {{--<div class="col-md-10 col-sm-10 col-xs-12">--}}
                                                {{--<input name="logo_img" type="file" class="file form-control col-md-7 col-xs-12">--}}
                                            {{--</div>--}}
                                        {{--</div>--}}
                                        <div class="ln_solid"></div>
                                        <div class="form-group">
                                            <div class="col-md-10 col-sm-10 col-xs-12 col-md-offset-3">
                                                <a href="javascript:history.go(-1);"><button type="button" class="btn btn-primary">取消</button></a>
                                                <button type="submit" class="btn btn-success">提交</button>
                                            </div>
                                        </div>

                                    {{ Form::close() }}
                                        @else
                                        {{ Form::open(['url'=>'/add_manage_project', 'id'=>'demo-form2', 'class'=> 'form-horizontal form-label-left', 'files' => true, 'method' => 'post']) }}
                                        <div class="form-group">
                                            {{--<input type="hidden" value="{{$project->logo_img}}" name="old_img">--}}
                                            <input type="hidden" value="{{$project->image1}}" name="image1_old">
                                            <input type="hidden" value="{{$project->image2}}" name="image2_old">
                                            <input type="hidden" value="{{$project->img1}}" name="img1_old">
                                            <input type="hidden" value="{{$project->img2}}" name="img2_old">
                                            <input type="hidden" value="{{$project->img3}}" name="img3_old">
                                            <input type="hidden" value="{{$project->project_id}}" name="project_id">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="first-name">项目名称
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="project_name" type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" value="{{$project->project_name}}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="first-name">开始时间
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="start_time" type="text"  required="required" class="form-control col-md-7 col-xs-12 time" value="{{date("Y-m-d",$project->start_time)}}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="first-name">到期时间
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="end_time" type="text"  required="required" class="form-control col-md-7 col-xs-12 time" value="{{date("Y-m-d",$project->end_time)}}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="last-name">出票公司
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select class="form-control"  name="company_name">
                                                    <option value="0">请选择…</option>
                                                    @foreach($company_name as $k => $v)
                                                        <option value="{{$v->company_name}}" @if($v->company_name == $project->company_name) selected @endif>{{$v->company_name}}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="last-name">保理公司
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select class="form-control"  name="factoring_company">
                                                    <option value="0">请选择…</option>
                                                    @foreach($factoring_company as $k => $v)
                                                        <option value="{{$v->f_company_name}}" @if($v->f_company_name == $project->factoring_company) selected @endif>{{$v->f_company_name}}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="last-name">合作机构
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select class="form-control"  name="partner">
                                                    <option value="0">请选择…</option>
                                                    @foreach($partner as $k => $v)
                                                        <option value="{{$v->partner_id}}" @if($v->partner_id == $project->partner_id) selected @endif>{{$v->partner_name}}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2 col-sm-2 col-xs-12" for="last-name">公司名称
                                            </label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="company_name" type="text" id="last-name" class="form-control col-md-7 col-xs-12" value="{{$project->company_name}}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目规模</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="project_scale" class="form-control col-md-7 col-xs-12" type="text" value="{{$project->project_scale}}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">年收益率</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="yield_rate" class="form-control col-md-7 col-xs-12" type="text" value="{{$project->yield_rate}}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目期限</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="limit" class="form-control col-md-7 col-xs-12" type="text" value="{{$project->limit}}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">还款方式</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select class="form-control"  name="pay_id">
                                                    <option value="0">请选择…</option>
                                                    @foreach($pay_type as $k => $p)
                                                        <option value="{{ $k }}" @if($k == $project->pay_id)selected @endif>{{ $p }}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">票据种类</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select id="ticket_type" class="form-control" name="ticket_type">
                                                    <option value="0">请选择…</option>
                                                    @foreach($plate_type as $k => $p)
                                                        <option value="{{ $k }}"  @if($k == $project->ticket_type)selected @endif>{{$p}}</option>
                                                    @endforeach
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目类别</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <select id="type" class="form-control" name="type">
                                                    <option value="0" >请选择…</option>
                                                    <option value="1"  @if($project->type == 1) selected @endif>央票通</option>
                                                    <option value="2" @if($project->type == 2)  selected @endif>上市通</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">借款用途</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <script id="editor1" type="text/plain" style="width:100%" name="purpose" >{{$project->purpose}}</script>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目介绍</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <script id="editor2" type="text/plain" style="width:100%" name="content" >{{$project->content}}</script>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">商票样式</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="image1" type="file" class="file form-control col-md-7 col-xs-12">
                                                <img src="{{$project->image1}}" alt="" height="180" weight="250"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">商票样式</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="image2" type="file" class="file form-control col-md-7 col-xs-12">
                                                <img src="{{$project->image2}}" alt="" height="180" weight="250"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">资料图片</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="img1" type="file" class="file form-control col-md-7 col-xs-12">
                                                <img src="{{$project->img1}}" alt="" height="180" weight="250"/>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">资料图片</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="img2" type="file" class="file form-control col-md-7 col-xs-12">
                                                <img src="{{$project->img2}}" alt="" height="180" weight="250"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">资料图片</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <input name="img3" type="file" class="file form-control col-md-7 col-xs-12">
                                                <img src="{{$project->img3}}" alt="" height="180" weight="250"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目状态</label>
                                            <div class="col-md-10 col-sm-10 col-xs-12">
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" value="0" checked> 审核中
                                                </label>
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" value="1"> 未通过
                                                </label>
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" value="2"> 已通过
                                                </label>
                                            </div>
                                        </div>
                                        {{--<div class="form-group">--}}
                                            {{--<label for="middle-name" class="control-label col-md-2 col-sm-2 col-xs-12">项目图片</label>--}}
                                            {{--<div class="col-md-10 col-sm-10 col-xs-12">--}}
                                                {{--<img src="{{$project->logo_img}}" alt="">--}}
                                                {{--<input name="logo_img" type="file" class="file form-control col-md-7 col-xs-12">--}}
                                            {{--</div>--}}
                                        {{--</div>--}}
                                        <div class="ln_solid"></div>
                                        <div class="form-group">
                                            <div class="col-md-10 col-sm-10 col-xs-12 col-md-offset-3">
                                                <a href="javascript:history.go(-1);"><button type="button" class="btn btn-primary">取消</button></a>
                                                <button type="submit" class="btn btn-success">提交</button>
                                            </div>
                                        </div>
                                        @endif
                                </div>
                            </div>
                        </div>

                        <br />
                        <br />
                        <br />

                    </div>
                </div>

                <!-- footer content -->

                <footer>
                    <div class="">
                        <p class="pull-right">Copyright 2016 mutouw.com All rights reserved. |
                            <span class="lead"> <i class="fa fa-logo-footer"></i> 央票通后台管理系统</span>
                        </p>
                    </div>
                    <div class="clearfix"></div>
                </footer>
                <!-- /footer content -->
            </div>
            <!-- /page content -->

        </div>
    </div>

    <div id="custom_notifications" class="custom-notifications dsp_none">
        <ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group">
        </ul>
        <div class="clearfix"></div>
        <div id="notif-group" class="tabbed_notifications"></div>
    </div>
    </body>
@stop